Allow network requests in instances of the CurrencyRate and TokenRate controllers to be disabled#1002
Merged
Allow network requests in instances of the CurrencyRate and TokenRate controllers to be disabled#1002
Conversation
legobeat
reviewed
Dec 2, 2022
danjm
reviewed
Dec 2, 2022
danjm
reviewed
Dec 2, 2022
danjm
reviewed
Dec 2, 2022
danjm
reviewed
Dec 2, 2022
Contributor
|
I think that with these modifications to this the extension PR, we can greatly simplify the changes in this controllers PR: https://github.com/MetaMask/metamask-extension/compare/optional-currency-conversion...optional-currency-conversion-alt?expand=1 I believe that we can simplify this PR to: https://github.com/MetaMask/controllers/compare/allow-disabled-config-tokenratescontroller?expand=1 |
c09ad06 to
14c1c78
Compare
…o be enabled or not
Contributor
|
This PR is now ready for review |
mcmire
reviewed
Dec 2, 2022
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
legobeat
reviewed
Dec 3, 2022
Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
f4f0fb2 to
3536d03
Compare
… - test name as per review comment
mcmire
previously approved these changes
Dec 5, 2022
Contributor
mcmire
left a comment
There was a problem hiding this comment.
A couple more suggestions but overall I'm good with this PR.
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
danjm
approved these changes
Dec 6, 2022
Contributor
|
This PR is the same as it was when Elliot previously approved, except that two code comments suggested by Elliot have since been added. |
gantunesr
pushed a commit
that referenced
this pull request
Dec 8, 2022
… controllers to be disabled (#1002) **Allow network requests in instances of the CurrencyRate and TokenRate controllers to be disabled** **Description** - BREAKING: - A new private property is added to the CurrencyRateController: `enabled`. If this is false, then the function in that controller which makes network requests will not make any requests when called. This property is controlled by the `start` and `stop` methods, so that these methods will effectively enable or disable network requests. Previously, even if `stop` had been called, `setNativeCurrency` or `setCurrentCurrency` would trigger a network request. That is now prevented. - FIXED: - The TokenRatesController previously had a bug whereby if a `disabled` property was passed to the constructive as part of the `config` object, it would be ignored / overwritten to false. This PR fixes that. **Checklist** - [ ] Tests are included if applicable - [ ] Any added code is fully documented **Issue** Part of [#16724](MetaMask/metamask-extension#16724) Co-authored-by: Dan J Miller <danjm.com@gmail.com> Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com> Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> Co-authored-by: Pedro Figueiredo <pedro.figueiredo@consensys.net> Co-authored-by: Pedro Figueiredo <ganseki.figueiredo@gmail.com>
2 tasks
MajorLift
pushed a commit
that referenced
this pull request
Oct 11, 2023
… controllers to be disabled (#1002) **Allow network requests in instances of the CurrencyRate and TokenRate controllers to be disabled** **Description** - BREAKING: - A new private property is added to the CurrencyRateController: `enabled`. If this is false, then the function in that controller which makes network requests will not make any requests when called. This property is controlled by the `start` and `stop` methods, so that these methods will effectively enable or disable network requests. Previously, even if `stop` had been called, `setNativeCurrency` or `setCurrentCurrency` would trigger a network request. That is now prevented. - FIXED: - The TokenRatesController previously had a bug whereby if a `disabled` property was passed to the constructive as part of the `config` object, it would be ignored / overwritten to false. This PR fixes that. **Checklist** - [ ] Tests are included if applicable - [ ] Any added code is fully documented **Issue** Part of [#16724](MetaMask/metamask-extension#16724) Co-authored-by: Dan J Miller <danjm.com@gmail.com> Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com> Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> Co-authored-by: Pedro Figueiredo <pedro.figueiredo@consensys.net> Co-authored-by: Pedro Figueiredo <ganseki.figueiredo@gmail.com>
MajorLift
pushed a commit
that referenced
this pull request
Oct 11, 2023
… controllers to be disabled (#1002) **Allow network requests in instances of the CurrencyRate and TokenRate controllers to be disabled** **Description** - BREAKING: - A new private property is added to the CurrencyRateController: `enabled`. If this is false, then the function in that controller which makes network requests will not make any requests when called. This property is controlled by the `start` and `stop` methods, so that these methods will effectively enable or disable network requests. Previously, even if `stop` had been called, `setNativeCurrency` or `setCurrentCurrency` would trigger a network request. That is now prevented. - FIXED: - The TokenRatesController previously had a bug whereby if a `disabled` property was passed to the constructive as part of the `config` object, it would be ignored / overwritten to false. This PR fixes that. **Checklist** - [ ] Tests are included if applicable - [ ] Any added code is fully documented **Issue** Part of [#16724](MetaMask/metamask-extension#16724) Co-authored-by: Dan J Miller <danjm.com@gmail.com> Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com> Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> Co-authored-by: Pedro Figueiredo <pedro.figueiredo@consensys.net> Co-authored-by: Pedro Figueiredo <ganseki.figueiredo@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow network requests in instances of the CurrencyRate and TokenRate controllers to be disabled
Description
BREAKING:
enabled. If this is false, then the function in that controller which makes network requests will not make any requests when called. This property is controlled by thestartandstopmethods, so that these methods will effectively enable or disable network requests. Previously, even ifstophad been called,setNativeCurrencyorsetCurrentCurrencywould trigger a network request. That is now prevented.FIXED:
disabledproperty was passed to the constructive as part of theconfigobject, it would be ignored / overwritten to false. This PR fixes that.Checklist
Issue
Part of #16724